﻿@model ConferenceTrafficInfoModel
@{
	ViewBag.Title = Resources.ConferenceTrafficInfo + ConstValues.strDash + ViewBag.ConferenceName;
}
<div id="menuBar" style="height:35px;">
	<div style="float: left; padding: 5px 5px; font-weight: bold; text-align: left;">
		@Resources.FullName/@Resources.Mobile/@Resources.Mail：<input id="selNameMobileMail" class="easyui-textbox" style="height:27px; width:200px;" />&nbsp;&nbsp;
		@Resources.TrafficName：<input id="selTraffic" class="easyui-combobox" style="height:27px; width:200px;" />&nbsp;&nbsp;
		@Resources.TrafficType：<select class="easyui-combobox" id="selTrafficType" style="height:27px; width:200px;" data-options="editable:false,panelHeight:'auto'">
			<option value="">@Resources.All</option>
			<option value="@ConstValues.TrafficType.接机">@Resources.ArrivalService</option>
			<option value="@ConstValues.TrafficType.送机">@Resources.DeparturalService</option>
			<option value="@ConstValues.TrafficType.接送机">@Resources.ArrivalDeparturalService</option>
		</select>&nbsp;&nbsp;
		@Resources.Status：<select class="easyui-combobox" id="selStatus" style="height:27px; width:200px;" data-options="editable:false,panelHeight:'auto'">
			<option value="">@Resources.All</option>
			<option value="@ConstValues.Status.已预订">@Resources.HasBooked</option>
			<option value="@ConstValues.Status.已取消">@Resources.ScheduleStatusCancel</option>
		</select>&nbsp;&nbsp;
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-search" onclick="searchData();">@Resources.Search</a>&nbsp;&nbsp;
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-export" onclick="exportData();" plain="true">@Resources.Export</a>
	</div>
	<form id="frmExport" method="post" target="iframeDownload" action="@Url.Action(nameof(ConferenceTrafficInfoController.Export))">
		@Html.AntiForgeryToken()
		<input type="hidden" id="hdnIds" name="allId" />
		<input type="hidden" id="hidConferenceId" name="conferenceId" />
	</form>
	<div class="clear"></div>
</div>
<div id="dataGrid"></div>

@section bodyParts {
<div id="trafficBookingWindow" class="easyui-window"
	title="@Resources.Create" data-options="closed:true,minimizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<form id="trafficForm">
				@Html.AntiForgeryToken()
				<table id="receivingBooking" style="margin-bottom: 30px;width:600px;margin:0 auto">
					<tr>
						<td valign="top" rowspan="5" style="width:13px;padding-top:20px"><input type = "checkbox" id="receivingCheckBox" name="receivingCheckBox" onchange="selectReceiving()" style="margin-top:5px"></td>
						<td style="padding-left :30px;padding-top:24px;font-size:16px;font-weight:bold"> @Resources.ReceivingService</td>
					</tr>
					<tr>
						<td style="padding-left :30px;padding-top:10px">@Resources.ArrivalDate：<input id="arrivalDate" name="arrivalDate" class="easyui-datetimebox" style="height:27px; width:400px;" data-options="editable:false" disabled></td>
					</tr>
					<tr>
						<td style="padding-left :30px;padding-top:10px">@Resources.FlightTrainNumber：<input id="arrivalNumber" name ="arrivalNumber" class="easyui-textbox" style="height:27px; width:400px;" data-options="" disabled></td>
					</tr>
					<tr>
						<td style="padding-left :30px;padding-top:10px">@Resources.TrafficName：<input id="arrivalName" name ="arrivalName" class="easyui-combobox" style="height:27px; width:400px;" data-options="" disabled></td>
					</tr>
					<tr>
						<td style="padding-left :30px;padding-top:10px">@Resources.Price：<span id="arrivalPrice"></span><input type="hidden" id="hidArrivalPrice"/></td>
					</tr>
				</table>
				<table id="deliveryBooking" style="margin-bottom: 30px;width:600px;margin:0 auto">
					<tr>
						<td valign="top" rowspan="5" style="width:13px;padding-top:20px"><input type = "checkbox" id="deliveryCheckBox" name="deliveryCheckBox" onchange="selectDelivery()" style="margin-top:5px"></td>
						<td style="padding-left :30px;padding-top:24px;font-size:16px;font-weight:bold"> @Resources.DeliveryService</td>
					</tr>
					<tr>
						<td style="padding-left :30px;padding-top:10px">@Resources.DepartureTime：<input id="deliveryDate" name="deliveryDate" class="easyui-datetimebox" style="height:27px; width:400px;" data-options="editable:false" disabled></td>
					</tr>
					<tr>
						<td style="padding-left :30px;padding-top:10px">@Resources.FlightTrainNumber：<input id="deliveryNumber" name ="deliveryNumber" class="easyui-textbox" style="height:27px; width:400px;" data-options="" disabled></td>
					</tr>
					<tr>
						<td style="padding-left :30px;padding-top:10px">@Resources.TrafficName：<input id="deliveryName" name ="deliveryName" class="easyui-combobox" style="height:27px; width:400px;" data-options="" disabled></td>
					</tr>
					<tr>
						<td style="padding-left :30px;padding-top:10px">@Resources.Price：<span id="deliveryPrice"></span><input type="hidden" id="hidDeliveryPrice" /></td>
					</tr>
					</table>
					<table style=" margin-bottom: 30px;width:600px;margin:0 auto">						
					<tr>
						<td valign="top" rowspan="5" style="width:13px;padding-top:20px"></td>
						<td style="padding-left :30px;padding-top:40px;"> @Resources.Contact：<input id="trafficContactName" name="trafficContactName" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true"></td>
					</tr>
					<tr >
						<td style="padding-left :30px;padding-top:10px;"> @Resources.Mobile：<input id="trafficContactMobile" name="trafficContactMobile" class="easyui-numberbox" style="height:27px; width:300px;" data-options="required:true,min:0,precision:0"></td>
					</tr>
					<tr >
						<td style="padding-left :30px;padding-top:10px;"> @Resources.Mail：<input id="trafficContactMail" name="trafficContactMail" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['email','length[1,100]']"></td>
					</tr>
					<tr>
						<td style="padding-left :30px;padding-top:10px;height:55px" valign="top" ><span>@Resources.Remark：</span><input id="trafficRemark" name="trafficRemark" class="easyui-textbox" style="height:50px; width:500px;" data-options="multiline:true,validType:['length[1,1000]']"></td>
					</tr>
						
				</table>
				<input type="hidden" id="hdnSubmitType" >
				<input type="hidden" id="profileTrafficId" name="profileTrafficId">
				<input  type="hidden" id="hidConferenceId2" name="conferenceId"/>
				<input  type="hidden" id="hidCurrency" name="currency"/>
			</form>
			<div class="clear"></div>
			<div style="padding: 25px 0; text-align: center;">					
				<input type="button" class="gbtn" onclick="doTrafficBooking();" value="@Resources.Save"/>
				<input type="button" class="rbtn" onclick="$('#trafficBookingWindow').window('close');" value="@Resources.Cancel" />
			</div>
		</div>
	</div>
</div>
}

@section Scripts {
<script>
	common.setCurrentMenu("ConferenceTrafficInfo");
	common.setCurrentParentMenu("#menu_a4");

	$(function () {
		$("#hidConferenceId").val("@Model.ConferenceId");
		$("#hidConferenceId2").val("@Model.ConferenceId");
		var orgCount = 0;
		$("#selTraffic").combobox({
			editable: false,
			valueField: "id",
			textField: "name",
			url: "@Url.Action(nameof(UtilityController.GetTrafficWithAll),
					nameof(UtilityController).GetControllerName())" + "?conferenceId=" + $("#hidConferenceId").val(),
			onLoadSuccess: function(data) {
				orgCount = data.length;
			},
			onShowPanel: function () {
				if (orgCount < 10) {
					$(this).combobox("panel").height("auto");
				} else {
					$(this).combobox("panel").height(200);
				}
			},
		});

		$("#selNameMobileMail").textbox("textbox").bind("keydown", function (e) {
			if (e.keyCode == 13) {
				searchData()
			}
		});
		$("#selTraffic").textbox("textbox").bind("keydown", function (e) {
			if (e.keyCode == 13) {
				searchData()
			}
		});
		$("#selTrafficType").textbox("textbox").bind("keydown", function (e) {
			if (e.keyCode == 13) {
				searchData()
			}
		});
		$("#selStatus").textbox("textbox").bind("keydown", function (e) {
			if (e.keyCode == 13) {
				searchData()
			}
		});

		$("#dataGrid").datagrid({
			url: "@Url.Action(nameof(ConferenceTrafficInfoController.GetData),
					nameof(ConferenceTrafficInfoController).GetControllerName(), new { ConferenceId = Model.ConferenceId })",
			method: "get",
			fitColumns: true,
			width: $(window).width() - 285,
			height: $(window).height() - 158,
			nowrap: false,
			pagination: true,
			remoteSort:true,
			pageSize: @ConstValues.DefaultGridRows,
			striped: true,
			toolbar: "#toolBar",
			pageSize: 100,
			pageList: [100, 200, 300, 400, 500],
			rowStyler: function(index, row) {
				if (row.status == "@ConstValues.Status.已取消") {
					return "background-color:#CCCCCC;";
				}
			},
			columns: [[
				{ field: "chk", align: "center", checkbox: true },
				{ field: "id", hidden: true },
				@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) ||
					Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceTrafficInfo, RoleType.修改) ||
					Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceTrafficInfo, RoleType.删除))
				{
					<text>
					{
						field: "operate", title: "@Resources.Operate", align: "center", width: 100,
						formatter: function(value, rec) {
							var strInfo = "";
							if (rec.status == "@ConstValues.ScheduleStatus.已取消") {
								@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) || Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceTrafficInfo, RoleType.修改))
								{
									<text>
									strInfo = "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='trafficDetailModify(\""
										+ rec.id + "\",\""+ rec.trafficType + "\",\""+ rec.currency + "\")'>@Resources.Modify</a>";
									</text>
								}
								if (strInfo != "") {
									strInfo += "&nbsp;|&nbsp;";
								}
								@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) || Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceTrafficInfo, RoleType.删除))
								{
									<text>
									strInfo += "<a href='#' style='color:#000000;font-weight:bold;text-decoration:underline;' onclick='bookingData(\""
										+ rec.id + "\")'>@Resources.ScheduleRecover</a>";
									</text>
								}
							} else {
								@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) || Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceTrafficInfo, RoleType.修改))
								{
									<text>
									strInfo = "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='trafficDetailModify(\""
										+ rec.id + "\",\""+ rec.trafficType + "\",\""+ rec.currency + "\")'>@Resources.Modify</a>";
									</text>
								}
								if (strInfo != "") {
									strInfo += "&nbsp;|&nbsp;";
								}
								@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) || Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceTrafficInfo, RoleType.删除))
								{
									<text>
									strInfo += "<a href='#' style='color:#DC143C;font-weight:bold;text-decoration:underline;' onclick='cancelData(\""
										+ rec.id + "\")'>@Resources.Cancel</a>";
									</text>
								}
							}
							return strInfo;
						}
					},
					</text>
				}
				{
					field: "status", title: "@Resources.Status", align: "center", sortable: true, width: 100,
					formatter: function(value, rec) {
						if (value=="@ConstValues.Status.已预订") {
							return "@Resources.HasBooked"
						} else {
							return "@Resources.ScheduleStatusCancel"
						}
					}
				},
				{ field: "orderNum", title: "@Resources.OrderNum", align: "center", sortable: true, width: 100 },
				{ field: "trafficName", title: "@Resources.TrafficName", align: "center", sortable: true, width: 100 },
				{ field: "trafficType", title: "@Resources.TrafficType", align: "center", sortable: true, width: 100 },
				{ field: "fullName", title: "@Resources.FullName", align: "center", sortable: true, width: 200 },
				{ field: "mobile", title: "@Resources.Mobile", align: "center", sortable: true, width: 100 },
				{ field: "mail", title: "@Resources.Mail", align: "center", sortable: true, width: 250 },
				{ field: "fee", title: "@Resources.Fee", align: "center", sortable: true, width: 100 },
				{ field: "currency", title: "@Resources.Currency", align: "center", sortable: true, width: 100 },
				{ field: "remark", title: "@Resources.Remark", align: "center", sortable: true, width: 200 },
			]],
			onBeforeLoad: function(param) {
				param.conferenceId = $("#hidConferenceId").val();
				param.random = Math.random();
			},
			onLoadSuccess: function(data) {
				var exportIdList = $("#hdnIds").val();
				if (data.rows.length > 0) {
					var exportIdArray = exportIdList.split(',');
					for (var rowIndex = 0; rowIndex < data.rows.length; rowIndex++)
					{
						for (var index = 0; index < exportIdArray.length; index++)
						{
							if (data.rows[rowIndex].id == exportIdArray[index]) {
								$("input[type='checkbox']").eq(rowIndex + 1).prop("checked", true);
								break;
							}
						}
					}
				}
			},
			onCheck: function (rowIndex, rowData) {
				var exportIdList = $("#hdnIds").val();
				var strId = rowData.id.toString();
				if (exportIdList == "") {
					$("#hdnIds").val(strId);
				} else {
					var exportIdArray = exportIdList.split(',');
					var newArray = exportIdArray.concat(strId);
					$("#hdnIds").val(newArray.join());
				}
			},
			onUncheck: function (rowIndex, rowData) {
				var exportIdList = $("#hdnIds").val();
				var exportIdArray = exportIdList.split(',');
				var strId = rowData.id.toString();
				exportIdArray.remove(strId);
				$("#hdnIds").val(exportIdArray.join());
			},
			onCheckAll: function (rows) {
				var exportIdList = $("#hdnIds").val();
				if (exportIdList == "") {
					var newArray = new Array();
					for (var index = 0; index < rows.length; index++) {
						var strId = rows[index].id.toString();
						newArray = newArray.concat(strId);
					}
					$("#hdnIds").val(newArray.join());
				} else {
					var exportIdArray = exportIdList.split(',');
					var newArray = exportIdArray;
					for (var index = 0; index < rows.length; index++) {
						var strId = rows[index].id.toString();
						if (newArray.indexOf(strId) < 0) {
							newArray = newArray.concat(strId);
						}
					}
					$("#hdnIds").val(newArray.join());
				}
			},
			onUncheckAll: function (rows) {
				var exportIdList = $("#hdnIds").val();
				var exportIdArray = exportIdList.split(',');
				for (var index = 0; index < rows.length; index++) {
					var strId = rows[index].id.toString();
					exportIdArray.remove(strId);
				}
				$("#hdnIds").val(exportIdArray.join());
			},
		});

		$(window).resize(function () {
			$("#dataGrid").datagrid("resize", {
				width: $(window).width() - 285,
				height: $(window).height() - 158
			});
		});

		$("#trafficBookingWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			top: 100
		});

		$("#arrivalDate").datetimebox({
			showSeconds: false
		});

		$("#deliveryDate").datetimebox({
			showSeconds: false
		});
	});

	function searchData() {
		$("#dataGrid").datagrid("load", {
			SelNameMobileMail: $("#selNameMobileMail").textbox("getValue"),
			SelTraffic: $("#selTraffic").textbox("getValue"),
			SelTrafficType: $("#selTrafficType").combobox("getValue"),
			SelStatus: $("#selStatus").combobox("getValue"),
		});
	}

	function exportData() {
		var exportIdList = $("#hdnIds").val();

		if (exportIdList == "") {
			$.messager.alert("@Resources.Export", "@Resources.MsgRecordMust", "warning");
			return;
		}

		$("#frmExport").submit();
	}

	function trafficDetailModify(id, trafficType, currency) {
		var loading = layer.load(0, {
			shade: [0.4, "#fff"]
		});
		$("#hdnSubmitType").val("edit");
		$("#profileTrafficId").val(id);
		$("#hidCurrency").val(currency);
		var url = "@Url.Action(nameof(ProfileTrafficController.GetTrafficDetail), nameof(ProfileTrafficController).GetControllerName())" + "?id=" + id;
				
		$.post(url, $("#trafficForm").serialize(), function (data, textStatus, jqXHR) {
			if (data.result == "@ConstValues.AjaxFailResult") {
				common.showError(data.message);
				layer.close(loading);
			} else {				
				$("#arrivalName").combobox({
					url: "@Url.Action(nameof(MeetingBookingController.GetReceivingTrafficName),
							nameof(MeetingBookingController).GetControllerName())"
							+ "?conferenceId=" + $("#hidConferenceId").val()
							+"&currency="+$("#hidCurrency").val(),
					valueField: "id",
					textField: "name",
					required: true,
					editable: false,
					panelHeight: "auto",
					onSelect: function (rec) {
						if (rec.currency == "@ConstValues.Currency.美元") {
							$("span[id='arrivalPrice']").html(rec.price + " " + "@Resources.DollarPerTime");
						} else {
							$("span[id='arrivalPrice']").html(rec.price + " " + "@Resources.RmbPerTime");
						}
					}
				});
				$("#deliveryName").combobox({
					url: "@Url.Action(nameof(MeetingBookingController.GetDeliveryTrafficName),
							nameof(MeetingBookingController).GetControllerName())"
							+ "?conferenceId=" + $("#hidConferenceId").val()
							+"&currency="+$("#hidCurrency").val(),
					valueField: "id",
					textField: "name",
					required: true,
					editable: false,
					panelHeight: "auto",
					onSelect: function (rec) {
						if (rec.currency == "@ConstValues.Currency.美元") {
							$("span[id='deliveryPrice']").html(rec.price + " " + "@Resources.DollarPerTime");
						} else {
							$("span[id='deliveryPrice']").html(rec.price + " " + "@Resources.RmbPerTime");
						}
					}
				});
				if(trafficType == "@ConstValues.TrafficType.接机") {					
					$("#arrivalDate").datetimebox({
						required: true,
						disabled: false
					});
					$("#arrivalDate").datetimebox("setValue", data.data.flightDate);
					
					$("#arrivalNumber").textbox({
						required: true,
						disabled: false
					});
					$("#arrivalNumber").textbox("setValue", data.data.flightNum);
					
					$("#arrivalName").combobox({
						required: true,
						disabled: false
					});
					$("#arrivalName").combobox("setValue", data.data.trafficId);
					if (data.data.currency == "@ConstValues.Currency.美元") {
						$("span[id='arrivalPrice']").html(data.data.fee + " " + "@Resources.DollarPerTime");
					} else {
						$("span[id='arrivalPrice']").html(data.data.fee + " " + "@Resources.RmbPerTime");
					}
					$("#receivingCheckBox").prop("checked",true);
					$("#deliveryCheckBox").prop("checked",false);
					$("#receivingBooking").show();
					$("#deliveryBooking").hide();

					$("#deliveryDate").datetimebox({
						required:false,
					});
					$("#deliveryNumber").textbox({
						required: false,
					});
					$("#deliveryName").combobox({
						required: false,
					});
				} else if (trafficType == "@ConstValues.TrafficType.送机") {					
					$("#deliveryDate").datetimebox({
						required:true,
						disabled: false
					});
					$("#deliveryDate").datetimebox("setValue", data.data.flightDate);
					
					$("#deliveryNumber").textbox({
						required: true,
						disabled: false
					});
					$("#deliveryNumber").textbox("setValue", data.data.flightNum);
					
					$("#deliveryName").combobox({
						required: true,
						disabled: false
					});
					$("#deliveryName").combobox("setValue", data.data.trafficId);
					if (data.data.currency == "@ConstValues.Currency.美元") {
						$("span[id='deliveryPrice']").html(data.data.fee + " " + "@Resources.DollarPerTime");
					} else {
						$("span[id='deliveryPrice']").html(data.data.fee + " " + "@Resources.RmbPerTime");
					}
					$("#receivingCheckBox").prop("checked",false);
					$("#deliveryCheckBox").prop("checked",true);
					$("#receivingBooking").hide();
					$("#deliveryBooking").show();
					$("#arrivalDate").datetimebox({
						required: false,
					});
					$("#arrivalNumber").textbox({
						required: false,
					});
					$("#arrivalName").combobox({
						required: false,
					});
				} else {
					$("#receivingBooking").hide();
					$("#deliveryBooking").hide();
				}
				$("#trafficContactName").textbox("setValue", data.data.fullName);
				$("#trafficContactMobile").textbox("setValue", data.data.mobile);
				$("#trafficContactMail").textbox("setValue", data.data.mail);
				$("#trafficRemark").textbox("setValue", data.data.remark);
				layer.close(loading);
				$("#trafficBookingWindow").window("open");
				$("#trafficBookingWindow").panel({title: "@Resources.Modify"+"@Resources.TrafficBooking"});				
			}
		});
	}	

	function cancelData(id) {
		var confirmMessage = "@Resources.CfmCancelBook";
		$.messager.confirm("@Resources.Cancel", confirmMessage, function (r) {
			if (r) {
				$("#profileTrafficId").val(id);
				$.post("@Url.Action(nameof(ConferenceTrafficInfoController.CancelBooking),
						nameof(ConferenceTrafficInfoController).GetControllerName(), new { ConferenceId = Model.ConferenceId })",
					$("#trafficForm").serialize(),
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
						} else {
							common.showSuccess(data.message, true);
							$("#dataGrid").datagrid("reload");
							$("#detailGrid").datagrid("reload");
						}
					}
				);
			}
		});
	};

	function doTrafficBooking() {
		var isValid = $("#trafficForm").form("validate");

		if (isValid ) {
			var loading = layer.load(0, {
				shade: [0.4, "#fff"]
			});
			var istrue = false;
			var list = [];
			
			var isChooseReceiving = $("#receivingCheckBox").prop("checked") ? true : false;
			var isChooseDelivery = $("#deliveryCheckBox").prop("checked") ? true : false;
				
			if (isChooseReceiving) {
				var model = {};
				model.isChooseReceiving = isChooseReceiving;
				model.flightDate = $("#arrivalDate").datetimebox("getValue");
				model.flightNum = $("#arrivalNumber").textbox("getValue");
				model.trafficId = $("#arrivalName").combobox("getValue");
				model.currency = $("#hidCurrency").val();
				model.contactName = $("#trafficContactName").textbox("getValue");
				model.contactMobile = $("#trafficContactMobile").textbox("getValue");
				model.contactMail = $("#trafficContactMail").textbox("getValue");
				model.remark = $("#trafficRemark").textbox("getValue");
				model.trafficType = "@ConstValues.TrafficType.接机";
				list.push(model)
			}
			if (isChooseDelivery) {
				var model = {};
				model.isChooseDelivery = isChooseDelivery;
				model.flightDate = $("#deliveryDate").datetimebox("getValue");
				model.flightNum = $("#deliveryNumber").textbox("getValue");
				model.trafficId = $("#deliveryName").combobox("getValue");
				model.currency = $("#hidCurrency").val();
				model.trafficType = "@ConstValues.TrafficType.送机";
				model.contactName = $("#trafficContactName").textbox("getValue");
				model.contactMobile = $("#trafficContactMobile").textbox("getValue");
				model.contactMail = $("#trafficContactMail").textbox("getValue");
				model.remark = $("#trafficRemark").textbox("getValue");
				list.push(model)
			}
			if (list.length == 0) {
				layer.close(loading);
				return;
			}
			
			var token = $("#trafficForm").find("input[name='__RequestVerificationToken']").eq(0).val();
			var model = {};
			model.trafficList = list;
			model.conferenceId = $("#hidConferenceId").val();
			model.orderNumber = $("#hidOrderNumber").val();
			switch ($("#hdnSubmitType").val())
			{
				case "add":
					
				case "edit":
					model.profileTrafficId = $("#profileTrafficId").val();
					$.post("@Url.Action(nameof(ConferenceTrafficInfoController.EditTraffic),
							nameof(ConferenceTrafficInfoController).GetControllerName(), new { ConferenceId = Model.ConferenceId })",
						  {
						  	"__RequestVerificationToken": token,
						  	"model": model,
						  },
						  function (data, textStatus, jqXHR) {
						  	layer.close(loading);
						  	if (data.result == "@ConstValues.AjaxFailResult") {
						  		common.showError(data.message);
						  		
						  	} else {
						  		common.showSuccess(data.message, true);
						  		$("#dataGrid").datagrid("reload");
						  		$("#detailGrid").datagrid("reload");
						  		$("#trafficBookingWindow").window("close");
			  		
						  	}
						  }
					);
					break;
			}
		}
	}

	function bookingData(id) {
		$("#profileTrafficId").val(id);
		$.post("@Url.Action(nameof(ConferenceTrafficInfoController.SetBooking),
				nameof(ConferenceTrafficInfoController).GetControllerName(), new { ConferenceId = Model.ConferenceId })",
			$("#trafficForm").serialize(),
			function(data, textStatus, jqXHR) {
				if (data.result == "@ConstValues.AjaxFailResult") {
					common.showError(data.message);
				} else {
					common.showSuccess(data.message, true);
					$("#dataGrid").datagrid("reload");
					
				}
			}
		);
	}
</script>
}